package com.yedean;

import org.springframework.context.ApplicationContext;

/**
 * SpringUtil
 *
 * @author yedean
 * @date 2022/9/21
 */
public class SpringUtil {
    
    private static ApplicationContext ac=null;

    public static ApplicationContext getApplicationContext() {
        return ac;
    }

    public static void setApplicationContext(ApplicationContext ac) {
        SpringUtil.ac = ac;
    }

    public static Object getBeanByName(String beanName) {
        return getApplicationContext().getBean(beanName);
    }

    public static Object getBeanByType(Class tClass) {
        return getApplicationContext().getBean(tClass);
    }
}
